import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import plugins from './vite/index';
import { resolve } from 'node:path';

export default defineConfig({
  base: '/',
  plugins: [plugins('', false)],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
    extensions: ['.js', '.ts', '.jsx', '.tsx'],
  },
  server: {
    host: 'localhost',
    port: 88,
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        modifyVars: {
          hack: `true; @import (reference) "${resolve('src/design/index.less')}";`,
          'success-color': '#55D187', //  Success color
          'error-color': '#ED6F6F', //  False color
          'warning-color': '#EFBD47', //   Warning color
          'font-size-base': '14px', //  Main font size
          'border-radius-base': '2px', //  Component/float fillet
        },
      },
    },
  },
});
